<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     default_iphone
 * @copyright   Copyright (c) 2013 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * @see Mage_Downloadable_Block_Customer_Products_List
 */
?>
<?php $_items = $this->getItems(); ?>
<div class="page-title">
    <h1><?php echo Mage::helper('downloadable')->__('My Downloadable Products') ?></h1>
</div>
<div class="downloadable-products-history">
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <?php if(count($_items)): ?>
        <ol class="list">
            <?php $_odd = ''; ?>
            <?php foreach ($_items as $_item): ?>
            <li class="list-item">
                <dl>
                    <dt><?php echo $this->escapeHtml($_item->getPurchased()->getProductName()) ?> - <a href="<?php echo $this->getDownloadUrl($_item) ?>" title="<?php echo Mage::helper('downloadable')->__('Start Download') ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo $this->escapeHtml($_item->getLinkTitle()); ?></a></dt>
                    <dd><strong><?php echo Mage::helper('downloadable')->__('Order #') ?></strong> <a href="<?php echo $this->getOrderViewUrl($_item->getPurchased()->getOrderId()) ?>" title="<?php echo Mage::helper('downloadable')->__('View Order') ?>"><?php echo $_item->getPurchased()->getOrderIncrementId() ?></a></dd>
                    <dd><strong><?php echo Mage::helper('downloadable')->__('Date') ?></strong> <span class="nobr"><?php echo $this->formatDate($_item->getPurchased()->getCreatedAt()) ?></span></dd>
                    <dd><strong><?php echo Mage::helper('downloadable')->__('Status') ?></strong> <em><?php echo Mage::helper('downloadable')->__(ucfirst($_item->getStatus())) ?></em></dd>
                    <dd><strong><?php echo Mage::helper('downloadable')->__('Remaining Downloads') ?></strong> <?php echo $this->getRemainingDownloads($_item) ?></dd>
                </dl>
            </li>
            <?php endforeach; ?>
        </ol>
    <?php else: ?>
        <p><?php echo Mage::helper('downloadable')->__('You have not purchased any downloadable products yet.'); ?></p>
    <?php endif; ?>
    <?php echo $this->getChildHtml('pager'); ?>
    <div class="buttons-set">
        <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
    </div>
</div>
